package com.atjiao.cloud.controller;

import com.atjiao.cloud.Entity.demo;
import com.atjiao.cloud.Mapper.DemoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author jyp
 * * @data 2025/3/13
 **/
@RestController
@RequestMapping("/fish-monitoring")
public class democontroller {

    @Autowired
    private DemoMapper fishMonitoringMapper;

    // 插入鱼类监测数据
    @PostMapping("/insert")
    public int insertFishMonitoring(@RequestBody demo fishMonitoring) {
        return fishMonitoringMapper.insertFishMonitoring(fishMonitoring);
    }

    // 根据ID删除鱼类监测数据
    @DeleteMapping("/delete/{id}")
    public int deleteFishMonitoringById(@PathVariable Integer id) {
        return fishMonitoringMapper.deleteFishMonitoringById(id);
    }

    // 更新鱼类监测数据
    @PutMapping("/update")
    public int updateFishMonitoring(@RequestBody demo fishMonitoring) {
        return fishMonitoringMapper.updateFishMonitoring(fishMonitoring);
    }

    // 查询所有鱼类监测数据
    @GetMapping("/all")
    public List<demo> getAllFishMonitoring() {
        return fishMonitoringMapper.getAllFishMonitoring();
    }

    // 根据ID查询鱼类监测数据
    @GetMapping("/get/{id}")
    public demo getFishMonitoringById(@PathVariable Integer id) {
        return fishMonitoringMapper.getFishMonitoringById(id);
    }
}
